package com.heima.字符串综合练习;

import java.util.Scanner;

public class Daluanzifu {
    public static void main(String[] args) {
        //键盘输入任意字符，打乱里面内容
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入任意字符：");
        String str=sc.nextLine();
        //将字符串变成字符数组
        char[] ch = str.toCharArray();
        //打乱数组里面的内容
        for (int i = 0; i < ch.length; i++) {
            int index = (int) (Math.random() * ch.length);
            char temp = ch[i];
            ch[i] = ch[index];
            ch[index] = temp;
        }
        //把字符数组变回字符串
        for (int i = 0; i < ch.length; i++) {
            System.out.print(ch[i]);
        }


    }
}
